﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using BUS;
using DTO;

namespace GaSaiGon.GUI
{
    public partial class frmQuanLyGaSaiGon : Form
    {
        public frmQuanLyGaSaiGon()
        {
            InitializeComponent();
        }

        private void frmQuanLyGaSaiGon_Load(object sender, EventArgs e)
        {
            int MaTk = int.Parse(Tag.ToString());
            TaiKhoanBUS TaiKhoanBus = new TaiKhoanBUS();
            TaiKhoanDTO TaiKhoanDTO = new TaiKhoanDTO();
            TaiKhoanDTO.LayThongTinTaiKhoan(MaTk);
            tslbHoTen.Text = TaiKhoanBus.LayThongTinTaiKhoan_MaTaiKhoan(TaiKhoanDTO).Rows[0]["HoTen"].ToString();
            tslbChucVu.Text = TaiKhoanBus.LayThongTinTaiKhoan_MaTaiKhoan(TaiKhoanDTO).Rows[0]["LoaiChucVu"].ToString();
            int LoaiTaiKhoan = int.Parse(TaiKhoanBus.LayThongTinTaiKhoan_MaTaiKhoan(TaiKhoanDTO).Rows[0]["ChucVu"].ToString());
            if (LoaiTaiKhoan == 1)
            {
                btnQuanLyChuyenTau.Visible = true;
                btnQuanLyVe.Visible = true;
                btnQuanLyTaiKhoan.Visible = true;
                btnQuanLyTau.Visible = true;
            }
            if (LoaiTaiKhoan == 2)
            {
                btnQuanLyChuyenTau.Visible = false;
                btnQuanLyVe.Visible = false;
                btnQuanLyTaiKhoan.Visible = false;
            }
            if (LoaiTaiKhoan == 3)
            {
                btnQuanLyVe.Visible = false;
                btnQuanLyTaiKhoan.Visible = false;
                btnQuanLyTau.Visible = false;
            }
            if (LoaiTaiKhoan == 4)
            {
                btnQuanLyChuyenTau.Visible = false;
                btnQuanLyTaiKhoan.Visible = false;
                btnQuanLyTau.Visible = false;
            }
        }

        private void btnQuanLyVe_Click(object sender, EventArgs e)
        {
            frmQuanLyVe frm = new frmQuanLyVe();
            frm.Show();
        }

        private void btnQuanLyChuyenTau_Click(object sender, EventArgs e)
        {
            frmQuanLyChuyenTau _frmQLChuyenLau = new frmQuanLyChuyenTau();
            _frmQLChuyenLau.Show();
        }

        private void btnQuanLyTaiKhoan_Click(object sender, EventArgs e)
        {
            frmQuanLyTaiKhoan _frmQLTaiKhoan = new frmQuanLyTaiKhoan();
            _frmQLTaiKhoan.Show();
        }

        private void btnQuanLyTau_Click(object sender, EventArgs e)
        {
            frmQuanLyGaTau frm = new frmQuanLyGaTau();
            frm.Show();
        }

    }
}
